-
Notifications
You must be signed in to change notification settings - Fork 83
Tests: test for loading "store:..." keys. #16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
8c3db0b
to
adff61f
Compare
How this is supposed to work? I get:
P.S. It makes sense to record these dependencies in the test to make it work, |
adff61f
to
b8b69c8
Compare
ssl_provider_keys.t
Outdated
# Test prerequisites: | ||
# * OpenSSL >= 3 | ||
# * softhsm2 | ||
# * pkcs11-provider (https://github.com/latchset/pkcs11-provider) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding a descriptive error message for "missing pkcs11-provider" and using proper test prerequisites made this block excessive.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We still have to clarify which pkcs11 provider is required for this test (there are two now, see https://github.com/OpenSC/libp11/releases/tag/libp11-0.4.14).
But I found a better location for the link and removed this block.
ssl_provider_keys.t
Outdated
plan(skip_all => 'may not work, leaves coredump') | ||
unless $ENV{TEST_NGINX_UNSAFE}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason to mark this test unsafe similar to ssl_engine_keys.t ?
If not, I'd rather remove it. (Running through the sandbox should give some initial evidence.)
Speaking about ssl_engine_keys.t, I feel desire to stop marking it unsafe, in particular, since recent changes in a5e6efa, which made it more flexible.
In addition, using engines had stability issues, which seems to fixed now, some details are given in 6fd0486.
Last time I looked (maybe ~ 1 year ago), this test passed on all test builders.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As comments in the pkcs11-provider tests suggest, SOFTHSMv2 still can crash on deinitialization.
It makes sense to remove the unsafe mark from ssl_provider_keys.t, as we explicitly address that with pkcs11-module-quirks = no-deinit
, but I'd be wary of making the change to ssl_engine_keys.t without confirming that init = 1
workaround does the same.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It appears that we need to skip these tests when running against nginx built with sanitizers:
tests/ssl_provider_keys.t .............
==81209==You are trying to dlopen a /lib64/libsofthsm2.so shared library with RTLD_DEEPBIND flag which is incompatible with sanitizer runtime (see https://github.com/google/sanitizers/issues/611 for details). If you want to run /lib64/libsofthsm2.so library under sanitizers please remove RTLD_DEEPBIND from dlopen flags.
Can't start nginx at lib/Test/Nginx.pm line 408.
ssl_provider_keys.t
Outdated
|
||
my $d = $t->testdir(); | ||
|
||
$t->write_file('openssl.conf', <<EOF); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would write "openssl.conf" using idiom from ssl_engine_keys.t.
In addition to further reducing diffs, this would make it possible to run tests on FreeBSD,
by optionally adding module = /usr/local/lib/ossl-modules/pkcs11.so
(path taken following security/openssl-oqsprovider).
Although, FreeBSD ports don't deliver pkcs11-provider right now, this may change in future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FreeBSD choose a rather odd approach here. The default system-wide OpenSSL
- searches for providers in /usr/lib/ossl-modules
- removes the
modulesdir=/usr/lib/ossl-modules
from the libcrypto.pc
pkcs11-provider specifically requires this variable during build.
I suspect that providers on FreeBSD are meant to be built and used with OpenSSL from ports located at /usr/local, and that also takes care of the search path.
Your suggestion does not conflict with that though, so applied.
ssl_provider_keys.t
Outdated
my $t = Test::Nginx->new()->has(qw/http proxy http_ssl openssl:3/) | ||
->has_daemon('openssl')->has_daemon('softhsm2-util'); | ||
|
||
plan(skip_all => "not yet") unless $t->has_version('1.29.0'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have $t->try_run()
for this, to run tests that depend on new nginx syntax. Any reason to avoid using it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I want to be able to distinguish missing OSSL_STORE support from failing to load a key from the store. $t->try_run()
will skip in both cases, as you can confirm by writing an incorrect pin.
6c2084b
to
c7849ad
Compare
15ce88b
to
a10b864
Compare
a10b864
to
8a85d59
Compare
See nginx/nginx#436